package com.zw.re.service;

import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.data.redis.core.RedisTemplate;
import org.springframework.stereotype.Service;

/**
 * Created by zwz
 * date 2016/11/30
 * project com.zw.re.service
 */
@Service
public class RedisOpt {

    @Autowired
    private HashSetOpt hashSetOpt;
    @Autowired
    private ListOpt listOpt;
    @Autowired
    private HashMapOpt hashMapOpt;
    @Autowired
    private RedisTemplate redisTemplate;

    /**
     * 删除指定的KEY
     */
    public void deleteByKey(Object key) {
        redisTemplate.delete(key);
    }

    public void appendValue(Object key,String value) {
        redisTemplate.opsForValue().append(key, value);
    }
    public void appendValueToJson(Object key,String value) {
        redisTemplate.opsForValue().append(key, value);
    }

    public HashSetOpt hashSetOpt() {
        return hashSetOpt;
    }

    public ListOpt listOpt() {
        return listOpt;
    }

    public HashMapOpt hashMapOpt() {
        return hashMapOpt;
    }
}
